<!-- Importamos los metodos js del abm de clientes -->
<script type="text/javascript" src="<?php echo base_url(); ?>js/clientes.js"></script>

<!-- Identificador de seccion -->
<div>
	<hr>
	<ul class="breadcrumb">
		<li>
			<a href="<?php echo(site_url("inicio")); ?>">Home</a><span class="divider">/</span>
		</li>
		<li>
			<a href="<?php echo(current_url()); ?>">Clientes</a>
		</li>
	</ul>
	<hr>
</div>

<!-- start: Botonera Superior -->
<div class="row-fluid">					
	<a href="<?php echo(site_url("inicio")); ?>" class="quick-button-small span1">
		<i class="fa-icon-home"></i>
		<p>Home</p>						
	</a>
	<a href="<?php echo(site_url("cliente/abrirPantallaCrear")); ?>" class="quick-button-small span1">
		<i class="fa-icon-ok green"></i>
		<p>Crear</p>
	</a>
</div>
<!-- end: Botonera Superior -->

<!-- Listado de Clientes -->
<div class="row-fluid">
	<div class="box span12">
		<div class="box-header" data-original-title>
			<h2><i class="fa-icon-user"></i><span class="break"></span>Clientes</h2>
			<div class="box-icon">
				<a href="#" class="btn-minimize"><i class="icon-chevron-up"></i></a>				
			</div>
		</div>
		<div class="box-content">
			<table class="table table-striped table-bordered bootstrap-datatable datatable">
				<thead>
					<tr>
						<th>Cliente</th>
						<th>Dni</th>
						<th>Email</th>
						<th>Publicaciones Activas</th>
						<th>Creaci&oacute;n</th>						
						<th>Estado</th>
						<th>Acciones</th>
					</tr>
				</thead>   
				<tbody>
					<?php
						//Recorremos todos los clientes que nos paso el controlador y generamos la tabla html
						foreach ($clientes->result() as $cliente){
							echo('<tr>');
								echo ('<td>' . $cliente->apellido . ', ' . $cliente->nombre . '</td>');
								echo ('<td class="center">' . $cliente->dni . '</td>');
								echo ('<td class="center">' . $cliente->email . '</td>');
								echo ('<td class="center">' . $cliente->cantPublicaciones . '</td>');
								
								echo ('<td class="center">' . $cliente->fechaCreacionFormateada . '</td>');																					
								
								if($cliente->estado == 1)
									echo ('<td class="center"><span class="label label-success">Activo</span></td>');
								else
									echo ('<td class="center"><span class="label label-important">Inactivo</span></td>');
								
								echo('<td class="center">
										<a class="btn btn-success" href="'.site_url('publicacion/abrirPantallaCrear/'.$cliente->idCliente).'" title="Crear Publicaci&oacute;n">
											<i class="icon-bullhorn icon-white"></i>  
										</a>										
										<a class="btn btn-info" href="'.site_url('cliente/abrirPantallaModificar/'.$cliente->idCliente).'" title="Modificar Cliente">
											<i class="icon-edit icon-white"></i>  
										</a>
										<a onclick="eliminarCliente(\''.site_url('cliente/eliminar/'.$cliente->idCliente).'\', \''.$cliente->apellido .', '.$cliente->nombre.'\')" class="btn btn-danger" href="#" title="Eliminar Cliente">
											<i class="icon-trash icon-white"></i> 
										</a>
									</td>');
							echo('</tr>');
						}
					?>
					
					<!-- Ejemplos de registros
					<tr>
						<td>Anton Phunihel</td>
						<td class="center">2012/01/01</td>
						<td class="center">Member</td>
						<td class="center">
							<span class="label label-success">Active</span>
						</td>
						<td class="center">
							<a class="btn btn-success" href="#">
								<i class="icon-zoom-in icon-white"></i>  
							</a>
							<a class="btn btn-info" href="#">
								<i class="icon-edit icon-white"></i>  
							</a>
							<a class="btn btn-danger" href="#">
								<i class="icon-trash icon-white"></i> 
							</a>
						</td>
					</tr>
					<tr>
						<td>Clemens Janko</td>
						<td class="center">2012/02/01</td>
						<td class="center">Staff</td>
						<td class="center">
							<span class="label label-important">Banned</span>
						</td>
						<td class="center">
							<a class="btn btn-success" href="#">
								<i class="icon-zoom-in icon-white"></i>                                            
							</a>
							<a class="btn btn-info" href="#">
								<i class="icon-edit icon-white"></i>                                            
							</a>
							<a class="btn btn-danger" href="#">
								<i class="icon-trash icon-white"></i> 
							</a>
						</td>
					</tr>
					<tr>
						<td>Hristofor Sergio</td>
						<td class="center">2012/03/01</td>
						<td class="center">Member</td>
						<td class="center">
							<span class="label label-warning">Pending</span>
						</td>
						<td class="center">
							<a class="btn btn-success" href="#">
								<i class="icon-zoom-in icon-white"></i>                                            
							</a>
							<a class="btn btn-info" href="#">
								<i class="icon-edit icon-white"></i>                                            
							</a>
							<a class="btn btn-danger" href="#">
								<i class="icon-trash icon-white"></i> 
							</a>
						</td>
					</tr>			
					<tr>
						<td>Adinah Ralph</td>
						<td class="center">2012/06/01</td>
						<td class="center">Admin</td>
						<td class="center">
							<span class="label">Inactive</span>
						</td>
						<td class="center">
							<a class="btn btn-success" href="#">
								<i class="icon-zoom-in icon-white"></i>                                            
							</a>
							<a class="btn btn-info" href="#">
								<i class="icon-edit icon-white"></i>                                            
							</a>
							<a class="btn btn-danger" href="#">
								<i class="icon-trash icon-white"></i> 
							</a>
						</td>
					</tr>-->
				</tbody>
			</table>            
		</div>
	</div><!--/span-->
</div><!--/row-->

<hr>